import request from "@/api/index"

export default {
  /**
   * @description: 添加角色 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  getAllPermissionByFuncType(params) {
    const url = "/userManagement/functionPermission/queryTreeByFuncType"
    return request.get(url, params)
  },
  /**
   * @description: 添加角色 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  add(params) {
    const url = "userManagement/role/add"
    return request.post(url, params)
  },
  /**
   * @description: 编辑角色 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  edit(params) {
    const url = "userManagement/role/edit"
    return request.post(url, params)
  },
  /**
   * @description: 删除角色 *代表必填
   * @param {String/Number} staffId *
   * @return {Object}
   */
  delById(params) {
    const url = "/userManagement/role/delById"
    return request.get(url, params)
  },
  delByListId(params) {
    const url = 'userManagement/role/delListById'
    return request.get(url, params)
  },
  /**
   * @description: 条件查询角色 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  queryByCondition(params) {
    const url = "userManagement/role/queryByCondition"
    return request.post(url, params)
  },
  /**
   * @description: 条件查询去除超级管理员 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  queryByConditionRemoveAdmin(params) {
    const url = "userManagement/role/queryByConditionRemoveAdmin"
    return request.post(url, params)
  },
  /**
   * @description: 根据用户id查询已分配的角色列表 *代表必填
   * @param {Object} params *
   * @return {Object}
   */
  queryListByUserId(params) {
    const url = "/userManagement/role/queryListByUserId"
    return request.get(url, params)
  },
  /**
   * @description: 分页查询角色 *代表必填
   * @param {Object} params *
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @return {Object}
   */
  queryPageByCondition(params) {
    const url = "userManagement/role/queryPageByCondition"
    return request.post(url, params)
  },

  // ---------权限相关接口------------------------------------------------------
  /**
   * @description: 通过角色id查询功能权限列表 *代表必填
   * @param {Object} roleId *
   * @return {Object}
   */
  queryRoleFuncList(params) {
    const url = "userManagement/role/queryRoleFuncList"
    return request.get(url, params)
  },
  /**
   * @description: 给角色分配功能权限 *代表必填
   * @param {Object} roleId *
   * @return {Object}
   */
  addFuncList(params) {
    const url = "userManagement/role/addFuncList"
    return request.post(url, params)
  }
}
